/**
 * 项目名：化工企业安全生产信息化管理平台
 * 日期：    2020-07-26 23:34:21
 * Copyright (c) 2015- -版权所有
 */

package com.joysuch.wwyt.bp.entity;

import static javax.persistence.GenerationType.IDENTITY;

import java.util.Set;
import java.util.LinkedHashSet;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.JoinTable;
import javax.persistence.ManyToOne;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.EntityListeners;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;

import lombok.Data;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

@EntityListeners({AuditingEntityListener.class, AutoSetCommonFieldListener.class})
@Entity
@Table(name = "wwyt_bp_device_facility_repair_record")
@SQLDelete(sql = "update wwyt_bp_device_facility_repair_record set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_bp_device_facility_repair_record set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Data
public class BpDeviceFacilityRepairRecord implements java.io.Serializable {

    //columns START
    @Id
    @GeneratedValue(strategy = IDENTITY)

    //ID
    @Column(name = "ID", unique = true, nullable = false)
    private Long id;

    //租户
    @Column(name = "TENENT_ID")
    private Long tenentId;

    //组织机构代码
    @Column(name = "ORG_CODE", length = 64)
    private String orgCode;

    //维修开始日期
    @Column(name = "REPAIR_START_DATE")
    private java.util.Date repairStartDate;

    //维修完成日期
    @Column(name = "REPAIR_END_DATE")
    private java.util.Date repairEndDate;

    //维修负责人
    @Column(name = "REPAIR_USER_ID")
    private Long repairUserId;

    //维修负责单位
    @Column(name = "REPAIR_DEPART_ID")
    private Long repairDepartId;

    //维修相关作业
    @Column(name = "REPAIR_RELATED_SAFETY_JOB_IDS", length = 500)
    private String repairRelatedSafetyJobIds;

    //登记时间
    @Column(name = "REGISTER_TIME")
    private java.util.Date registerTime;

    //附件
    @Column(name = "ATTACHMENT_ID")
    private Long attachmentId;

    //异常项
    @Column(name = "EXCEPTION_ITEMS", length = 500)
    private String exceptionItems;

    //维修情况
    @Column(name = "REPAIR_STATUS", length = 500)
    private String repairStatus;

    //维修金额
    @Column(name = "repair_amount")
    private Double repairAmount;


    //创建人
    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    private Long createBy;

    //创建时间
    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    private java.util.Date createTime;

    //更新人
    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    private Long updateBy;

    //更新时间
    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    private java.util.Date updateTime;

    //删除标记
    @Column(name = "DELETE_FLAG", length = 2)
    private String deleteFlag;

    //设备装置ID(wwyt_bp_production_facility表)
    @Column(name = "DEVICE_FACILITY_ID")
    private Long deviceFacilityId;

    //登记人
    @Column(name = "REGISTER_USER_ID")
    private Long registerUserId;
    //columns END

    public int hashCode() {
        return new HashCodeBuilder()
                .append(getId())
                .toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof BpDeviceFacilityRepairRecord == false) return false;
        if (this == obj) return true;
        BpDeviceFacilityRepairRecord other = (BpDeviceFacilityRepairRecord) obj;
        return new EqualsBuilder()
                .append(getId(), other.getId())
                .isEquals();
    }
}

